package tgc.edu.tms.entity;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Transient;

import org.springframework.data.annotation.CreatedBy;

import com.fasterxml.jackson.annotation.JsonIgnore;

import tgc.edu.tms.custom.BaseEntity;

/*
 * 调停补记录表
 */
@Entity
public class TtbRecord extends BaseEntity<Integer>{
	private SysUser user; //申请对象
	@JsonIgnore
	private List<TtbPicture> picture = new ArrayList<>();//图片集合(记录和图片一对多关系)
	private String leaveType; //请假类型
	private String reason;//请假理由
	private String type;//调停补类型
	private String typeTwo;//停补状态（已停课）（已补课）
	private String state;//状态（申请中）（已同意） （已拒绝）
	private String opplyTime;//申请时间
	private String repairTime;//补课时间
	private String classroom;//上课地点
	private String tbClass;//某某班级
	private String curriculum;//课程
	private String suspendTime;    //停课时间
	private String section;//节次
	private String teacher;//调课 停课 补课老师
	private String address;//调课后地点
	private String jc;//调课后的节次（另一个节次）
	private Integer zxs;//总学时
	private Integer ydrs;//应到人数
	private String week;//星期
	private String lc;//楼层
	private String ld;//楼栋
	private String kclbs;   //课程类型
	private String opinion;		//意见
	private String year;		//年级
	private String term;		//学期
	private Boolean xmh;
	private Long xs;
	
	public String getLc() {
		return lc;
	}
	public void setLc(String lc) {
		this.lc = lc;
	}
	public String getLd() {
		return ld;
	}
	public void setLd(String ld) {
		this.ld = ld;
	}
	public Integer getZxs() {
		return zxs;
	}
	public void setZxs(Integer zxs) {
		this.zxs = zxs;
	}
	public Integer getYdrs() {
		return ydrs;
	}
	public void setYdrs(Integer ydrs) {
		this.ydrs = ydrs;
	}
	public String getWeek() {
		return week;
	}
	public void setWeek(String week) {
		this.week = week;
	}
	public String getJc() {
		return jc;
	}
	public void setJc(String jc) {
		this.jc = jc;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	@ManyToOne
	@CreatedBy
	public SysUser getUser() {
		return user;
	}
	public void setUser(SysUser user) {
		this.user = user;
	}
	@OneToMany(cascade=CascadeType.ALL, mappedBy="record")
	public List<TtbPicture> getPicture() {
		return picture;
	}
	public void setPicture(List<TtbPicture> picture) {
		this.picture = picture;
	}
	public String getLeaveType() {
		return leaveType;
	}
	public void setLeaveType(String leaveType) {
		this.leaveType = leaveType;
	}
	public String getReason() {
		return reason;
	}
	public void setReason(String reason) {
		this.reason = reason;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public String getTypeTwo() {
		return typeTwo;
	}
	public void setTypeTwo(String typeTwo) {
		this.typeTwo = typeTwo;
	}
	public String getState() {
		return state;
	}
	public void setState(String state) {
		this.state = state;
	}
	public String getOpplyTime() {
		return opplyTime;
	}
	public void setOpplyTime(String opplyTime) {
		this.opplyTime = opplyTime;
	}
	public String getRepairTime() {
		return repairTime;
	}
	public void setRepairTime(String repairTime) {
		this.repairTime = repairTime;
	}
	public String getClassroom() {
		return classroom;
	}
	public void setClassroom(String classroom) {
		this.classroom = classroom;
	}
	public String getTbClass() {
		return tbClass;
	}
	public void setTbClass(String tbClass) {
		this.tbClass = tbClass;
	}
	public String getCurriculum() {
		return curriculum;
	}
	public void setCurriculum(String curriculum) {
		this.curriculum = curriculum;
	}
	public String getSuspendTime() {
		return suspendTime;
	}
	public void setSuspendTime(String suspendTime) {
		this.suspendTime = suspendTime;
	}
	public String getSection() {
		return section;
	}
	public void setSection(String section) {
		this.section = section;
	}
	public String getTeacher() {
		return teacher;
	}
	public void setTeacher(String teacher) {
		this.teacher = teacher;
	}
	public String getKclbs() {
		return kclbs;
	}
	public void setKclbs(String kclbs) {
		this.kclbs = kclbs;
	}
	public String getOpinion() {
		return opinion;
	}
	public void setOpinion(String opinion) {
		this.opinion = opinion;
	}
	public String getYear() {
		return year;
	}
	public void setYear(String year) {
		this.year = year;
	}
	public String getTerm() {
		return term;
	}
	public void setTerm(String term) {
		this.term = term;
	}
	public Boolean getXmh() {
		return xmh;
	}
	public void setXmh(Boolean xmh) {
		this.xmh = xmh;
	}
	//获取图片id
	@Transient
	public String getTpId() {
		String str = "";
		for(TtbPicture t: getPicture()) {
			str += t.getId()+",";
		}
		if(str != "") {
			str = str.substring(0, str.length()-1);			
		}
		return str;
	}
	/*@Transient
	public String getName() {
		return user == null?null:user.getName();
	}*/
	public TtbRecord(SysUser user, String type, Long xs) {
		super();
		this.user = user;
		this.type = type;
		this.xs = xs;
	}
	public TtbRecord() {
		super();
	}
	public TtbRecord(Integer id, Boolean isUsed) {
		super(id, isUsed);
	}
	public TtbRecord(Integer id) {
		super(id);
	}
	
	@Transient
	public Long getXs() {
		return xs;
	}
	public void setXs(Long xs) {
		this.xs = xs;
	}
	
	
}
